package dataStructure.chapter05_队列.part1普通队列;

import java.util.LinkedList;
import java.util.List;

/**
 * @author https://gitee.com/W_Jun
 * @date 2022-01-19 12:28
 * @Description 用双向链表实现队列（在队列类内部构造一个链表，利用组合实现队列）
 */
public class MyQueueImp<E> {
    private List<E> list = new LinkedList<>();

    public int size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void enQueue(E element) {
        list.add(element);
    }

    public E deQueue() {
        return list.remove(0);
    }

    public E front() {
        return list.get(0);
    }

    public void clear() {
        list.clear();
    }
}
